package com.easyattendance.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;


@Entity
@Table(name="TBL_SUBJECT_CLASS")
@IdClass(SubjectClassPK.class)
public class SubjectClass {
	
	@Id
	@GenericGenerator(name="subject_id",strategy="foreign")
	@Column(name="subject_id",length=6,nullable=false)
	private String subject_id;
	
	@Id
	@GenericGenerator(name="class_id",strategy="foreign")
	@Column(name="class_id",length=15,nullable=false)
	private String class_id;
		
	@Column(name="total_lecture_hours",length=2,nullable=false)
	private int total_lecture_hours;
	
	@Column(name="lecture_hours_counter",length=2)
	private int lecture_hours_counter;
	
	@ManyToOne
	@JoinColumn(name="class_id", insertable=false, updatable=false, referencedColumnName="class_id")
	private Class classObj;
	
	@ManyToOne
	@JoinColumn(name="subject_id", insertable=false, updatable=false, referencedColumnName="subject_id")
	private Subject subject;
	
	public SubjectClass(){
	}
	
	public SubjectClass(String subject_id, String class_id,
			int total_lecture_hours, int lecture_hours_counter) {
		super();
		this.subject_id = subject_id;
		this.class_id = class_id;
		this.total_lecture_hours = total_lecture_hours;
		this.lecture_hours_counter = lecture_hours_counter;
	}

	public SubjectClass(String class_id) {
		super();
		this.class_id = class_id;
	}

	public SubjectClass(String subject_id, String class_id) {
		super();
		this.subject_id = subject_id;
		this.class_id = class_id;
	}

	public String getSubject_id() {
		return subject_id;
	}

	public void setSubject_id(String subject_id) {
		this.subject_id = subject_id;
	}

	public String getClass_id() {
		return class_id;
	}

	public void setClass_id(String class_id) {
		this.class_id = class_id;
	}


	public int getTotal_lecture_hours() {
		return total_lecture_hours;
	}


	public void setTotal_lecture_hours(int total_lecture_hours) {
		this.total_lecture_hours = total_lecture_hours;
	}
	
	public Class getClassObj() {
		return classObj;
	}

	public void setClassObj(Class classObj) {
		this.classObj = classObj;
	}

	public Subject getSubject() {
		return subject;
	}

	public void setSubject(Subject subject) {
		this.subject = subject;
	}

	public int getLecture_hours_counter() {
		return lecture_hours_counter;
	}

	public void setLecture_hours_counter(int lecture_hours_counter) {
		this.lecture_hours_counter = lecture_hours_counter;
	}
	
	
}
